package com.study.animationstudy

import android.content.Intent
import android.os.Build
import android.view.View
import android.view.View.OnClickListener
import android.widget.Toast
import com.study.animationstudy.base.BaseActivity
import com.study.animationstudy.databinding.ActivityMainBinding
import com.study.animationstudy.extension.actionStart
import com.study.animationstudy.ui.*

class MainActivity : BaseActivity<ActivityMainBinding>(),OnClickListener {

    override fun ActivityMainBinding.initBinding() {
        mBinding.apply {
            btnTweenAnim.setOnClickListener(this@MainActivity)
            btnSwingAnim.setOnClickListener(this@MainActivity)
            btnAnimSet.setOnClickListener(this@MainActivity)
            btnDm.setOnClickListener(this@MainActivity)

            btnBannerAnim.setOnClickListener(this@MainActivity)
            btnFrameAnim.setOnClickListener(this@MainActivity)
            btnGif.setOnClickListener(this@MainActivity)
            btnFadeAnim.setOnClickListener(this@MainActivity)

            btnObjectAnim.setOnClickListener(this@MainActivity)
            btnObjectGroup.setOnClickListener(this@MainActivity)
            btnInterpolator.setOnClickListener(this@MainActivity)

            btnPie.setOnClickListener(this@MainActivity)
            btnExpand.setOnClickListener(this@MainActivity)
            btnScroller.setOnClickListener(this@MainActivity)

            btnShutter.setOnClickListener(this@MainActivity)
            btnMosaic.setOnClickListener(this@MainActivity)
            btnYingji.setOnClickListener(this@MainActivity)
            btnDrawLayer.setOnClickListener(this@MainActivity)
        }
    }

    override fun onClick(v: View?) {
        v?.let {
            when(it.id){
                mBinding.btnTweenAnim.id -> {
                    actionStart(TweenAnimActivity::class.java)
                }
                mBinding.btnSwingAnim.id -> {
                    actionStart(SwingAnimActivity::class.java)
                }
                mBinding.btnAnimSet.id -> {
                    actionStart(AnimSetActivity::class.java)
                }

                mBinding.btnBannerAnim.id -> {
                    actionStart(BannerAnimActivity::class.java)
                }
                mBinding.btnFrameAnim.id -> {
                    actionStart(FrameAnimActivity::class.java)
                }
                mBinding.btnGif.id -> {
                    actionStart(GifActivity::class.java)
                }
                mBinding.btnFadeAnim.id -> {
                    actionStart(FadeAnimActivity::class.java)
                }

                mBinding.btnObjectAnim.id -> {
                    actionStart(ObjectAnimActivity::class.java)
                }
                mBinding.btnObjectGroup.id -> {
                    actionStart(ObjectGroupActivity::class.java)
                }
                mBinding.btnInterpolator.id -> {
                    actionStart(InterpolatorActivity::class.java)
                }

                mBinding.btnPie.id -> {
                    actionStart(PieActivity::class.java)
                }
                mBinding.btnExpand.id -> {
                    actionStart(ExpandActivity::class.java)
                }
                mBinding.btnScroller.id -> {
                    actionStart(ScrollerActivity::class.java)
                }

                mBinding.btnShutter.id -> {
                    actionStart(ShutterActivity::class.java)
                }
                mBinding.btnMosaic.id -> {
                    actionStart(MosaicActivity::class.java)
                }
                mBinding.btnYingji.id -> {
                    actionStart(YingjiActivity::class.java)
                }
                mBinding.btnDm.id -> {
                    actionStart(DmActivity::class.java)
                }
                mBinding.btnDrawLayer.id -> {
                    actionStart(DrawLayerActivity::class.java)
                }
            }
        }
    }

}